//
//  LLNWFileUploadTask+LLAudioUpload.m
//  LLFoundation
//
//  Created by my_liu on 2016/11/14.
//  Copyright © 2016年 . All rights reserved.
//

#import "LLNWFileUploadTask+LLAudioUpload.h"

@implementation LLNWFileUploadTask (LLAudioUpload)

+ (LLNWFileUploadTask *)taskWithAudioFile:(LLAudioModel*)audioFile withObserver:(NSObject*)observer withTaskIdentifier:(NSUInteger *)taskIdentifier
{
    LLNWFileUploadTask *task = [LLNWFileUploadTask taskWithFilePath:audioFile.tempEncodeFilePath withFileName:@"image.amr" withFormName:@"image" taskObserver:nil getTaskUniqueIdentifier:taskIdentifier];
    
    //自定义请求的Header
    NSString* timeStamp = [NSString stringWithFormat:@"%lld", (long long)[[NSDate date] timeIntervalSinceReferenceDate]];
    /*  这里还需要一个userId,需要外部给设置了 */
    NSDictionary *customRequestHeader = @{@"ClientTimeStamp":timeStamp,@"interface":@"UploadImages"};
    task.customRequestHeader = customRequestHeader;
    
    //自定义请求参数
    NSString* jsonArgs = [NSString stringWithFormat:@"{\"imageCount\":\"1\",\"nowatermark\":\"1\"}"];
    task.customRequestParams = @{@"jsonArgs": jsonArgs};
    
    //设置原始的文件对象
    task.userInfo = @{@"audioFile": audioFile};
    
    return task;
}

@end
